package com.cn.wanxi.service.impl;

import com.cn.wanxi.dto.CommonDTO;
import com.cn.wanxi.model.CompanyModel;
import com.cn.wanxi.model.NavModel;
import com.cn.wanxi.model.ResultModel;
import com.cn.wanxi.service.ICommonService;
import com.cn.wanxi.service.ICompanyService;
import com.cn.wanxi.service.INavService;

import java.util.List;

public class CommonServiceImpl implements ICommonService {
    @Override
    public ResultModel getFrontCommon() {
        ResultModel resultModel=new ResultModel();
        CommonDTO commonDTO=new CommonDTO();
        commonDTO.setCompanyModel(getCompanyModel());
        commonDTO.setNavList(getNavModelList());
        resultModel.setObject(commonDTO);
        return resultModel;
    }
    private CompanyModel getCompanyModel() {
        ICompanyService iCompanyService = new CompanyServiceImpl();
        CompanyModel companyModel = iCompanyService.getCompanyModel();
        return companyModel;
    }

    private List<NavModel> getNavModelList() {
        INavService iNavService = new NavServiceImpl();
        List<NavModel> navList = iNavService.getNavList();
        return navList;
    }

}
